package main

import "fmt"

func main() {

	tableName := "employees"
	createTable(db, tableName)

	employeeList := []Employee{
		Employee{
			Id:         1,
			Name:       "张三",
			Department: "技术部",
			Salary:     20000,
		},
		Employee{
			Id:         2,
			Name:       "李四",
			Department: "市场部",
			Salary:     8000,
		},
		Employee{
			Id:         3,
			Name:       "王五",
			Department: "技术部",
			Salary:     21000,
		},
		Employee{
			Id:         4,
			Name:       "神六",
			Department: "商务部",
			Salary:     12000,
		},
		Employee{
			Id:         5,
			Name:       "方七",
			Department: "客服部",
			Salary:     5000,
		},
		Employee{
			Id:         6,
			Name:       "黑八",
			Department: "技术部",
			Salary:     3000,
		},
	}

	insertTable(db, tableName, employeeList)

	employeeList, err := QueryEmployeesByDepartment(db, "技术部")
	if err != nil {
		fmt.Println("查询失败")
	}
	fmt.Println("技术部的员工信息为:", employeeList)

	bookTableName := "books"
	createBookTable(db, bookTableName)

	bookList := []Book{
		Book{
			ID:     2,
			Title:  "Go语言进阶",
			Author: "李四",
			Price:  29.9,
		},
		Book{
			ID:     3,
			Title:  "Go语言基础",
			Author: "张三",
			Price:  70.23,
		},
		Book{
			ID:     5,
			Title:  "python语言基础",
			Author: "王五",
			Price:  99.99,
		},
		Book{
			ID:     6,
			Title:  "java语言基础",
			Author: "李六",
			Price:  12.9,
		},
		Book{
			ID:     7,
			Title:  "swift语言基础",
			Author: "方七",
			Price:  56,
		},
	}
	insertBookTable(db, bookTableName, bookList)

	findBookList, err := queryBookByGreatPrice(db, bookTableName, 50)
	if err != nil {
		fmt.Println("查询书籍失败")
	}
	fmt.Println("查询大于价格50的书籍:", findBookList)

}
